package com.elephant.core.dynamicagent.jdk;

import java.lang.reflect.Proxy;

/**
 * @author hai
 * @description
 * @date 15:46 2018/8/20
 */
public class Test {

    public static void main(String[] args) {

        UserService userService = new UserServiceImpl();

        MyInvocationHandler invocationHandler = new MyInvocationHandler(userService);

        UserService userService1 = (UserService) Proxy.newProxyInstance(userService.getClass().getClassLoader()
                , userService.getClass().getInterfaces()
                , invocationHandler);

        System.out.println(userService1.getName(1222));
    }
}
